package com.pan.games.play;

/**
 * @author by panstark
 * @description
 * @notice
 * @date 2021/3/3
 */
public class PrintABC2 {

        public static volatile  int count = 0;
        public static void main(String[] args) {
            Thread a = new Thread(()->{
                while(true){
                    if(count%3==0){
                        System.out.println("a");
                        count++;
                    }
                }
            });

            Thread b = new Thread(()->{
                while(true) {
                    if (count % 3 == 1) {
                        System.out.println("b");
                        count++;
                    }
                }
            });

            Thread c = new Thread(()->{
                while(true) {
                    if (count % 3 == 2) {
                        System.out.println("c");
                        count++;
                    }
                }
            });
            a.start();
            b.start();
            c.start();
        }
}
